<?php
	include('connect.php');
	if(isset($_POST['app'])){
		if($_POST['app']==""){
			$sql=mysql_query("select * from users_emails where status=1 GROUP BY email");
		}else{
			$sql=mysql_query("select * from users_emails where status=1 and type='".$_POST['app']."'");
		}
	}else{
			$sql=mysql_query("select * from users_emails where status=1 GROUP BY email");
	}
	while($row=mysql_fetch_array($sql)){
			$array[] = array("action"=>'<input type="checkbox" id="checkbox[]" name="checkbox[]" onclick="checkVal();" value="'.$row['email_id'].'-'.$row['type'].'">',"Id" => $row['email_id'], "email" => $row['email'],"Added_date" => $row['added_date'],"Type" => $row['type'],"status"=>$row['status']);
		}
		//echo '<pre>'; print_r($array); exit;
	    $json_array = json_encode($array);
		echo $json_array;
?>